﻿/*
 * Created by SharpDevelop.
 * User: Ophelia
 * Date: 2012-10-12
 * Time: 오후 2:03
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using NtLibrary.Interface;
using NtLibrary.Pick;

namespace NtLibrary.Event
{
	/// <summary>
	/// Description of MousePickEvent.
	/// </summary>
	public class MousePickEventProcessor : NtLibrary.Interface.IMousePickEventProcessor
	{
		private IPickedable picked = null;
		private PictureManager manage;
		private Form form;
		
		public MousePickEventProcessor(PictureManager m)
		{
			SetPictureManager(m);
		}
		
		public void SetPictureManager(PictureManager m)
		{
			manage = m;
		}
		
		public void OnMouseDown(object sender, MouseEventArgs e)
		{
			
		}
		public void OnMouseMove(object sender, MouseEventArgs e)
		{
			if(e.Button == MouseButtons.Left){
				if(picked == null){
					picked = manage.Pick(e.X,e.Y);
				}else if(picked != null){
					MessageBox.Show(sender.ToString());
					//form.AText = "True";	//에러남
					picked.X = e.X - picked.Width/2;
					picked.Y = e.Y - picked.Height/2;
				}
			}else{
				//form.Text = "False";	//에러남
				picked = null;
			}
		}
		public void OnMouseUp(object sender, MouseEventArgs e)
		{
			
		}
	}
}
